#ifndef VERTEXDIRECTORY_H
#define VERTEXDIRECTORY_H

class VertexSet;
// holds all the vertices in the graph
#include <vector>
#include <map>
#include "Vertex.h"
#include "VertexSet.h"

using namespace std; 

typedef vector<bool> VertexKey;
typedef pair<VertexKey, VertexKey> VertexSetKey;


class VertexDirectory
{
public:
	VertexDirectory(map<vector<bool>, Vertex*>* vertices);
	~VertexDirectory();
	static Vertex* GetStaticCopyVertex(vector<bool> name);
	Vertex* GetWorkingCopyVertex(vector<bool> name);
	static void AddVertex(Vertex* vertex);
	static void RemoveVertex(vector<bool> name);
	void AddWorkingCopyVertex(Vertex* vertex);
	void RemoveWorkingCopyVertex(vector<bool> name);
	static int VertexCount();
	static void Clear();
	static set<vector<bool> >* CreateAllVertices(int n, int w);
	static void FillVertexDirectory(set<vector<bool> >* vertices);
	static map<vector<bool>, Vertex*>* GetStaticCopyVertices();
	map<vector<bool>, Vertex*>* GetWorkingCopyVertices();

	static Vertex* GetVertexFromDirectory(VertexKey name, VertexDirectory *dir);
	static void UpdateVertexDirectoryFromOther(VertexDirectory *updateFrom, VertexDirectory *updateTo);
	static void AddVertexSet(VertexSet *set);
	static VertexSet *GetVertexSet(VertexSetKey name);
	static void ClearAllVertexSets();
	static map<VertexSetKey, VertexSet*> *GetSavedVertexSets();


private:
	static map<vector<bool>, Vertex*>* m_Vertices; // finds vertex by name
	map<vector<bool>, Vertex*>* m_WorkingCopyVertices;
	static map<VertexSetKey, VertexSet*> m_VertexSets;


	static void AddVertexToDirectory(Vertex* vertex, map<vector<bool>, Vertex*>* vertices);
	static void RemoveVertexFromDirectory(vector<bool> name, map<vector<bool>, Vertex*>* vertices);
	static Vertex* GetStaticCopyVertexFromDirectory(vector<bool> name, map<vector<bool>, Vertex*>* vertices);
	
	
};

#endif